package com.qhg.saas_server.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qhg.saas_server.mapper.LogMapper;
import com.qhg.saas_server.pojo.Log;
import com.qhg.saas_server.pojo.dto.LogInfoDto;
import com.qhg.saas_server.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Slf4j
@Service
public class LogServiceImpl implements LogService {

    @Autowired
    LogMapper logMapper;

    public void insertLog(Log log){
        logMapper.insert(log);
    }

    @Override
    public PageInfo SelectAll(Integer pageNum,Integer pageSize,String comploName, String logTime) {
        PageHelper.startPage(pageNum,pageSize);
        List<LogInfoDto> logInfoDtos = logMapper.SelectAll(comploName, logTime);
        PageInfo<LogInfoDto> logInfoDtoPageInfo = new PageInfo<LogInfoDto>(logInfoDtos);
        return logInfoDtoPageInfo;
    }

    @Override
    public void DeleteByTime(String logTime) {
        logMapper.DeleteByTime(logTime);
    }

}
